package com.itheima.spider.dao;

import com.itheima.spider.pojo.News;
import com.itheima.spider.utils.C3P0Utils;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

public class NewsDao {
    public void saveNews(News news) throws SQLException {
        QueryRunner qr=new QueryRunner(C3P0Utils.getDataSource());
         String sql="insert into news values(?,?,?,?,?,?,?)";
         Object[]params={news.getId(),news.getTitle(),news.getTime(),
                 news.getSource(),news.getContent(),news.getEditor(),news.getDocurl()};
         qr.update(sql, params);


    }
}
